package Pantallas;

import javax.swing.JOptionPane;

import Codigos.Seccion;


public class FrmSeccion extends javax.swing.JFrame {
	private FrmMeneOpciones controlador;


    public FrmSeccion(FrmMeneOpciones controlador) {
        initComponents();
        this.controlador=controlador;
    }

   
    @SuppressWarnings("unchecked")
   
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();

        jButton1.setText("Guardar");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Cargar Seccion");
        getContentPane().setLayout(null);

        jLabel1.setText("Numero Seccion");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(16, 60, 140, 17);
        getContentPane().add(jTextField1);
        jTextField1.setBounds(180, 60, 150, 27);

        jButton2.setText("Cancelar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2);
        jButton2.setBounds(170, 110, 100, 29);

        jButton3.setText("Salir");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton3);
        jButton3.setBounds(10, 10, 90, 29);

        jButton4.setText("Guardar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton4);
        jButton4.setBounds(40, 110, 100, 29);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-359)/2, (screenSize.height-184)/2, 359, 184);
    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
       
        jTextField1.setText("");
    }

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
    	int n=0;
    	n= Integer.parseInt(jTextField1.getText());
    	
    	controlador.getSeccion().setNumseccion(n);
    	
    	JOptionPane.showMessageDialog(rootPane,"Seccion Asignada");
    	this.dispose();
    }

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }

  
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
              
                new FrmSeccion(null).setVisible(true);
            }
        });
    }


    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField jTextField1;


}
